/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import Logic.ReportePDF;
import Logic.LectorSalidaComp;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.DocumentException;
import java.awt.Color;
import java.awt.Image;
import java.awt.Toolkit;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.WindowConstants;

/**
 *
 * @author Nico 
 * Clase de la Ventana de Resultados Comparación, donde se muestra
 * la imagen de la dosis calculada por el Sistema de Verificación, la imagen de
 * la dosis calculada por el Planificador, la imagen Gamma como resultado de la
 * comparacion, y la cantidad de puntos analizados, junto con el porcentaje de
 * puntos que pasaron de manera correcta, y los que no.
 */
public class ResultadosComparacion extends javax.swing.JFrame {

    private String ruta;
    private String archivo;
    private ResultadosConvolucion padre;
    private double cantPuntosPasaron;
    private double porcentajePaso;

    /**
     * Creates new customizer ResulComparacion
     */
    public ResultadosComparacion(String ruta, String nombreArchivo, ResultadosConvolucion padre) {
        initComponents();
        pack();
        this.setExtendedState(MAXIMIZED_BOTH);
        this.paciente.setText(nombreArchivo.substring(0, nombreArchivo.length() - 4));
        this.ruta = ruta;
        this.archivo = nombreArchivo;
        this.padre = padre;
        LectorSalidaComp lector = new LectorSalidaComp(this.ruta);
        lector.AbrirArchivo();
        this.cantPuntosPasaron = lector.getCantidadPuntos();
        this.porcentajePaso = lector.getPorcentaje();
        setearImagenes();
        DTAValor.setText(padre.dtaU);
        DosisValor.setText(padre.dosisU);
        UmbralValor.setText(padre.umbralU);
        this.setVisible(true);
    }

    private void setearImagenes() {
        Toolkit tk = Toolkit.getDefaultToolkit();
        String rutaImagen1 = this.ruta + (this.archivo.substring(0, this.archivo.length() - 4)) + "_dosis_TPS.jpg";
        String rutaImagen2 = this.ruta + (this.archivo.substring(0, this.archivo.length() - 4)) + "_dosis_Calc.jpg";
        String rutaImagen3 = this.ruta + (this.archivo.substring(0, this.archivo.length() - 4)) + "_indice_Gamma.jpg";

        Image image1 = tk.createImage(rutaImagen1);
        Image image2 = tk.createImage(rutaImagen2);
        Image image3 = tk.createImage(rutaImagen3);

        imagen1.setIcon(new ImageIcon(image1.getScaledInstance(imagen1.getWidth(), imagen1.getHeight(), Image.SCALE_AREA_AVERAGING)));
        imagen2.setIcon(new ImageIcon(image2.getScaledInstance(imagen2.getWidth(), imagen2.getHeight(), Image.SCALE_AREA_AVERAGING)));
        imagen3.setIcon(new ImageIcon(image3.getScaledInstance(imagen3.getWidth(), imagen3.getHeight(), Image.SCALE_AREA_AVERAGING)));

        this.cantPuntosValor.setText(Double.toString(this.cantPuntosPasaron));
        if ((porcentajePaso >= 90) && (porcentajePaso <= 100)) {
            this.porcentPasoValor.setBackground(Color.green);
        } else {
            if ((porcentajePaso >= 85) && (porcentajePaso < 90)) {
                this.porcentPasoValor.setBackground(Color.yellow);
            } else if (porcentajePaso < 85) {
                this.porcentPasoValor.setBackground(Color.red);
            }
        }
        this.porcentPasoValor.setText(Double.toString(this.porcentajePaso));
        Float aux = new Float(Math.rint((100 - this.porcentajePaso) * 1000) / 1000);
        this.porcentNoPasoValor.setText(Float.toString(aux));

    }

    public double getCantPuntosPasaron() {
        return cantPuntosPasaron;
    }

    public double getPorcentajePaso() {
        return porcentajePaso;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the FormEditor.
     */
    @Override
    public Image getIconImage() {
        Image retValue = Toolkit.getDefaultToolkit().getImage(ClassLoader.getSystemResource("IMG/3-400.png"));
        return retValue;
    }
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        imagen1 = new javax.swing.JLabel();
        imagen2 = new javax.swing.JLabel();
        botonVolver = new javax.swing.JButton();
        imagen3 = new javax.swing.JLabel();
        imagenIndependiente = new javax.swing.JTextField();
        imagenTPS = new javax.swing.JTextField();
        imagenGamma = new javax.swing.JTextField();
        FirmaVentana = new javax.swing.JTextField();
        jPanel1 = new javax.swing.JPanel();
        paciente = new javax.swing.JTextField();
        DTAenMm = new javax.swing.JTextField();
        DTAValor = new javax.swing.JTextField();
        DosisEnPorcentaje = new javax.swing.JTextField();
        DosisValor = new javax.swing.JTextField();
        UmbralValor = new javax.swing.JTextField();
        UmbralEnPorcentaje = new javax.swing.JTextField();
        cantPuntos = new javax.swing.JTextField();
        cantPuntosValor = new javax.swing.JTextField();
        porcentPasoValor = new javax.swing.JTextField();
        porcentPaso = new javax.swing.JTextField();
        porcentNoPaso = new javax.swing.JTextField();
        porcentNoPasoValor = new javax.swing.JTextField();
        botonReporte = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Validación");
        setAlwaysOnTop(true);
        setForeground(java.awt.Color.black);
        setIconImage(getIconImage());
        setMaximumSize(new java.awt.Dimension(2147, 2147));
        setPreferredSize(new java.awt.Dimension(1366, 768));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        imagen1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        imagen2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        botonVolver.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        botonVolver.setLabel("Volver");
        botonVolver.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonVolverActionPerformed(evt);
            }
        });

        imagen3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        imagenIndependiente.setBackground(new java.awt.Color(215, 215, 215));
        imagenIndependiente.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        imagenIndependiente.setText(" Cálculo Independiente");
        imagenIndependiente.setBorder(null);
        imagenIndependiente.setFocusable(false);

        imagenTPS.setBackground(new java.awt.Color(215, 215, 215));
        imagenTPS.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        imagenTPS.setText(" Imagen TPS");
        imagenTPS.setBorder(null);
        imagenTPS.setFocusable(false);

        imagenGamma.setBackground(new java.awt.Color(215, 215, 215));
        imagenGamma.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        imagenGamma.setText(" Imagen Gamma");
        imagenGamma.setBorder(null);
        imagenGamma.setFocusable(false);

        FirmaVentana.setEditable(false);
        FirmaVentana.setBackground(new java.awt.Color(215, 215, 215));
        FirmaVentana.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        FirmaVentana.setForeground(new java.awt.Color(0, 51, 255));
        FirmaVentana.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        FirmaVentana.setText("Proyecto Final ISI - Burgos, Scarafia - IMRT");
        FirmaVentana.setBorder(null);
        FirmaVentana.setFocusable(false);
        FirmaVentana.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                FirmaVentanaActionPerformed(evt);
            }
        });

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        paciente.setEditable(false);
        paciente.setBackground(new java.awt.Color(215, 215, 215));
        paciente.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        paciente.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        paciente.setText("-");
        paciente.setBorder(null);
        paciente.setFocusable(false);
        paciente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pacienteActionPerformed(evt);
            }
        });

        DTAenMm.setEditable(false);
        DTAenMm.setBackground(new java.awt.Color(215, 215, 215));
        DTAenMm.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        DTAenMm.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        DTAenMm.setText("DTA (En mm):");
        DTAenMm.setBorder(null);
        DTAenMm.setFocusable(false);
        DTAenMm.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DTAenMmActionPerformed(evt);
            }
        });

        DTAValor.setEditable(false);
        DTAValor.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        DTAValor.setFocusable(false);
        DTAValor.setRequestFocusEnabled(false);

        DosisEnPorcentaje.setEditable(false);
        DosisEnPorcentaje.setBackground(new java.awt.Color(215, 215, 215));
        DosisEnPorcentaje.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        DosisEnPorcentaje.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        DosisEnPorcentaje.setText("Dosis (En porcentaje):");
        DosisEnPorcentaje.setBorder(null);
        DosisEnPorcentaje.setFocusable(false);
        DosisEnPorcentaje.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DosisEnPorcentajeActionPerformed(evt);
            }
        });

        DosisValor.setEditable(false);
        DosisValor.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        DosisValor.setFocusable(false);
        DosisValor.setRequestFocusEnabled(false);

        UmbralValor.setEditable(false);
        UmbralValor.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        UmbralValor.setFocusable(false);
        UmbralValor.setRequestFocusEnabled(false);

        UmbralEnPorcentaje.setEditable(false);
        UmbralEnPorcentaje.setBackground(new java.awt.Color(215, 215, 215));
        UmbralEnPorcentaje.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        UmbralEnPorcentaje.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        UmbralEnPorcentaje.setText("Umbral (En porcentaje):");
        UmbralEnPorcentaje.setBorder(null);
        UmbralEnPorcentaje.setFocusable(false);
        UmbralEnPorcentaje.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                UmbralEnPorcentajeActionPerformed(evt);
            }
        });

        cantPuntos.setEditable(false);
        cantPuntos.setBackground(new java.awt.Color(215, 215, 215));
        cantPuntos.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        cantPuntos.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        cantPuntos.setText("Cantidad de Puntos que se examinaron:");
        cantPuntos.setBorder(null);
        cantPuntos.setFocusable(false);
        cantPuntos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cantPuntosActionPerformed(evt);
            }
        });

        cantPuntosValor.setEditable(false);
        cantPuntosValor.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        cantPuntosValor.setFocusable(false);

        porcentPasoValor.setEditable(false);
        porcentPasoValor.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        porcentPasoValor.setFocusable(false);

        porcentPaso.setEditable(false);
        porcentPaso.setBackground(new java.awt.Color(215, 215, 215));
        porcentPaso.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        porcentPaso.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        porcentPaso.setText("Porcentaje que pasó:");
        porcentPaso.setBorder(null);
        porcentPaso.setFocusable(false);
        porcentPaso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                porcentPasoActionPerformed(evt);
            }
        });

        porcentNoPaso.setEditable(false);
        porcentNoPaso.setBackground(new java.awt.Color(215, 215, 215));
        porcentNoPaso.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        porcentNoPaso.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        porcentNoPaso.setText("Porcentaje que no pasó:");
        porcentNoPaso.setBorder(null);
        porcentNoPaso.setFocusable(false);
        porcentNoPaso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                porcentNoPasoActionPerformed(evt);
            }
        });

        porcentNoPasoValor.setEditable(false);
        porcentNoPasoValor.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        porcentNoPasoValor.setFocusable(false);

        botonReporte.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        botonReporte.setText("Generar reporte");
        botonReporte.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonReporteActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 446, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                        .addGap(25, 25, 25)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(porcentPaso)
                                        .addComponent(porcentNoPaso, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(cantPuntos, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(DosisEnPorcentaje, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(UmbralEnPorcentaje, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(DTAenMm, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGap(0, 0, Short.MAX_VALUE)
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(cantPuntosValor, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(UmbralValor, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(DosisValor, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(DTAValor, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addComponent(porcentPasoValor, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(porcentNoPasoValor, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(botonReporte, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(paciente, javax.swing.GroupLayout.PREFERRED_SIZE, 446, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(36, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(paciente, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(DTAenMm, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(DTAValor, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(DosisEnPorcentaje, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(DosisValor, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(UmbralEnPorcentaje, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(UmbralValor, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(7, 7, 7)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(1, 1, 1)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cantPuntosValor, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cantPuntos, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(porcentPasoValor, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(porcentPaso, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(porcentNoPasoValor, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(porcentNoPaso, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(30, 30, 30)
                .addComponent(botonReporte, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 1, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(FirmaVentana)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(174, 174, 174)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(imagenTPS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(imagen1, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(imagenGamma, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(299, 299, 299))
                                .addComponent(imagen3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 495, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(155, 155, 155))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(imagenIndependiente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(botonVolver, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(imagen2, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(194, 194, 194))))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(FirmaVentana, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(imagenTPS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(imagenIndependiente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(imagen1, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(imagen2, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(imagenGamma, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(7, 7, 7)
                        .addComponent(imagen3, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(botonVolver, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(31, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void porcentNoPasoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_porcentNoPasoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_porcentNoPasoActionPerformed

    private void porcentPasoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_porcentPasoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_porcentPasoActionPerformed

    private void cantPuntosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cantPuntosActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cantPuntosActionPerformed
    /**
     * Boton Generar Reporte, el cual genera el reporte correspondiente, en PDF,
     * de la verificacion, junto con los datos del paciente.
     *
     * @param evt
     */
    private void botonReporteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonReporteActionPerformed
        try {
            ReportePDF reporte = new ReportePDF(ruta.substring(0, ruta.length()-7), archivo, cantPuntosPasaron, porcentajePaso, DTAValor.getText(), DosisValor.getText(), UmbralValor.getText());
            setAlwaysOnTop(false);
            JOptionPane.showMessageDialog(null, "El reporte se ha generado con éxito.");
            setAlwaysOnTop(true);
        } catch (FileNotFoundException ex) {
            JOptionPane.showMessageDialog(this, "Error al crear el reporte, por favor verifique que no se encuentre abierto.");
        } catch (DocumentException ex) {
            Logger.getLogger(ResultadosComparacion.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_botonReporteActionPerformed

    private void botonVolverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonVolverActionPerformed

        padre.setVisible(true);
        this.dispose();

    }//GEN-LAST:event_botonVolverActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        
        setAlwaysOnTop(false);
        int eleccion = JOptionPane.showConfirmDialog(null, "¿Esta seguro que desea cerrar el programa?", "Cerrando Sistema", 2);
        if (eleccion == 0) {
            System.exit(0);
        } else {
            setAlwaysOnTop(true);
            setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
        }
    }//GEN-LAST:event_formWindowClosing

    private void FirmaVentanaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FirmaVentanaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_FirmaVentanaActionPerformed

    private void DosisEnPorcentajeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DosisEnPorcentajeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_DosisEnPorcentajeActionPerformed

    private void UmbralEnPorcentajeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UmbralEnPorcentajeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_UmbralEnPorcentajeActionPerformed

    private void DTAenMmActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DTAenMmActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_DTAenMmActionPerformed

    private void pacienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pacienteActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_pacienteActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField DTAValor;
    private javax.swing.JTextField DTAenMm;
    private javax.swing.JTextField DosisEnPorcentaje;
    private javax.swing.JTextField DosisValor;
    private javax.swing.JTextField FirmaVentana;
    private javax.swing.JTextField UmbralEnPorcentaje;
    private javax.swing.JTextField UmbralValor;
    private javax.swing.JButton botonReporte;
    private javax.swing.JButton botonVolver;
    private javax.swing.JTextField cantPuntos;
    private javax.swing.JTextField cantPuntosValor;
    private javax.swing.JLabel imagen1;
    private javax.swing.JLabel imagen2;
    private javax.swing.JLabel imagen3;
    private javax.swing.JTextField imagenGamma;
    private javax.swing.JTextField imagenIndependiente;
    private javax.swing.JTextField imagenTPS;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTextField paciente;
    private javax.swing.JTextField porcentNoPaso;
    private javax.swing.JTextField porcentNoPasoValor;
    private javax.swing.JTextField porcentPaso;
    private javax.swing.JTextField porcentPasoValor;
    // End of variables declaration//GEN-END:variables
}
